package  gearunits.models{
	import org.papervision3d.core.math.NumberUV;
	import org.papervision3d.core.math.Number3D;
	import org.papervision3d.core.geom.renderables.Triangle3D;
	import org.papervision3d.core.geom.renderables.Vertex3D;
	import org.papervision3d.core.geom.TriangleMesh3D;
	import org.papervision3d.core.proto.MaterialObject3D;

	public class PMeshBuildingMechFactory extends TriangleMesh3D {
		private var ve:Array;
		private var fa:Array;

		public function PMeshBuildingMechFactory(material : MaterialObject3D ) {
			super( material, new Array(), new Array() );
			ve = this.geometry.vertices;
			fa = this.geometry.faces;
			v(16.000000,0.000000,13.000000);
			v(16.000000,0.000000,-13.000000);
			v(-16.000002,0.000000,-12.999996);
			v(-15.999992,0.000000,13.000006);
			v(15.000008,16.000000,12.999992);
			v(14.999990,16.000000,-13.000010);
			v(-15.000006,16.000000,-12.999994);
			v(-14.999998,16.000000,13.000000);
			v(-16.499998,17.599998,13.000000);
			v(16.500008,17.599998,12.999991);
			v(-17.599993,-0.000000,13.000007);
			v(17.600000,-0.000000,13.000000);
			v(17.600000,0.000001,16.000000);
			v(-17.599993,0.000001,16.000008);
			v(16.500008,17.600000,15.999991);
			v(-16.499998,17.600000,16.000000);
			v(-16.500006,17.599998,-12.999993);
			v(16.499990,17.599998,-13.000010);
			v(-17.600002,-0.000000,-12.999996);
			v(17.600000,-0.000000,-13.000000);
			v(17.600000,-0.000001,-16.000000);
			v(-17.600002,-0.000001,-15.999996);
			v(16.499990,17.599998,-16.000011);
			v(-16.500006,17.599998,-15.999993);

			f(20,22,21,0.535453,0.344095,0.736825,0.356061,0.536688,0.746762,-0.000000,-1.000000,-0.000001);
			f(22,23,21,0.736825,0.356061,0.737983,0.733561,0.536688,0.746762,-0.000001,-1.000000,0.000000);
			f(16,18,23,0.738602,0.948594,0.737983,0.746867,0.772920,0.948488,-0.998053,0.000000,0.062378);
			f(18,21,23,0.737983,0.746867,0.772301,0.746762,0.772920,0.948488,-0.998053,-0.000000,0.062378);
			f(19,17,20,0.842175,0.746762,0.842794,0.948488,0.807857,0.746867,0.998053,0.000000,0.062379);
			f(17,22,20,0.842794,0.948488,0.808476,0.948594,0.807857,0.746867,0.998053,-0.000000,0.062379);
			f(17,16,23,0.273560,0.402878,0.272402,0.780378,0.238084,0.780273,-0.000000,0.000000,1.000000);
			f(17,23,22,0.273560,0.402878,0.238084,0.780273,0.239242,0.402773,0.000000,-0.000000,1.000000);
			f(18,19,20,0.236849,0.402773,0.238084,0.805440,0.203766,0.805545,0.000000,0.000000,-1.000000);
			f(18,20,21,0.236849,0.402773,0.203766,0.805545,0.202530,0.402878,0.000000,0.000000,-1.000000);
			f(2,1,19,0.334101,0.362398,0.332978,0.728459,0.332922,0.746762,0.000000,0.683941,0.729537);
			f(2,19,18,0.334101,0.362398,0.332922,0.746762,0.334158,0.344095,0.000000,0.717900,-0.696146);
			f(5,6,16,0.516044,0.717581,0.517097,0.374399,0.535453,0.357296,0.000001,1.000000,-0.000000);
			f(5,16,17,0.516044,0.717581,0.535453,0.357296,0.534294,0.734796,0.000001,1.000000,0.000000);
			f(1,5,19,0.332978,0.728459,0.516044,0.717581,0.332922,0.746762,0.000000,1.000000,0.000001);
			f(5,17,19,0.516044,0.717581,0.534294,0.734796,0.332922,0.746762,0.000000,1.000000,0.000001);
			f(6,2,18,0.517097,0.374399,0.334101,0.362398,0.334158,0.344095,0.000000,1.000000,-0.000000);
			f(6,18,16,0.517097,0.374399,0.334158,0.344095,0.535453,0.357296,0.000000,1.000000,-0.000000);
			f(14,12,13,0.202530,0.792239,0.001235,0.805440,0.000000,0.402773,0.000000,1.000000,0.000001);
			f(14,13,15,0.202530,0.792239,0.000000,0.402773,0.201372,0.414738,0.000000,1.000000,0.000000);
			f(10,8,13,0.772920,0.948488,0.773539,0.746762,0.807238,0.948594,-0.998053,-0.000000,0.062378);
			f(8,15,13,0.773539,0.746762,0.807857,0.746867,0.807238,0.948594,-0.998053,-0.000000,0.062378);
			f(9,11,12,0.843413,0.948594,0.842794,0.746867,0.877112,0.746762,0.998053,-0.000000,0.062378);
			f(9,12,14,0.843413,0.948594,0.877112,0.746762,0.877731,0.948488,0.998053,-0.000000,0.062378);
			f(8,9,14,0.297446,0.780273,0.298604,0.402773,0.332922,0.402878,-0.000000,-0.000001,1.000000);
			f(8,14,15,0.297446,0.780273,0.332922,0.402878,0.331764,0.780379,-0.000000,-0.000001,1.000000);
			f(11,10,13,0.298604,0.402773,0.297369,0.000105,0.331687,0.000000,0.000000,0.000000,-1.000000);
			f(11,13,12,0.298604,0.402773,0.331687,0.000000,0.332922,0.402667,0.000000,0.000000,-1.000000);
			f(0,3,10,0.298548,0.384469,0.297425,0.018408,0.297369,0.000105,-0.000000,-0.258736,-0.965948);
			f(0,10,11,0.298548,0.384469,0.297369,0.000105,0.298604,0.402773,-0.000000,-0.507692,-0.861539);
			f(7,4,9,0.921105,0.717581,0.922158,0.374399,0.940513,0.357296,-0.000000,-1.000000,-0.000000);
			f(7,9,8,0.921105,0.717581,0.940513,0.357296,0.939355,0.734796,-0.000000,-1.000000,-0.000000);
			f(4,0,11,0.922158,0.374399,0.739162,0.362398,0.739218,0.344095,-0.000000,-1.000000,-0.000000);
			f(4,11,9,0.922158,0.374399,0.739218,0.344095,0.940513,0.357296,-0.000000,-1.000000,-0.000000);
			f(3,7,10,0.738039,0.728459,0.921105,0.717581,0.737983,0.746762,-0.000001,-1.000000,-0.000000);
			f(7,8,10,0.921105,0.717581,0.939355,0.734796,0.737983,0.746762,-0.000000,-1.000000,-0.000000);
			f(2,6,7,0.631400,0.000563,0.814787,0.000000,0.815700,0.297425,-0.998053,0.000000,0.062378);
			f(2,7,3,0.631400,0.000563,0.815700,0.297425,0.632312,0.297987,-0.998053,0.000000,0.062378);
			f(0,4,1,0.815700,0.000563,0.999088,0.000000,0.816612,0.297987,0.998053,0.000000,0.062378);
			f(4,5,1,0.999088,0.000000,1.000000,0.297425,0.816612,0.297987,0.998053,-0.000001,0.062379);
			f(4,7,5,0.631400,0.000912,0.630347,0.344095,0.333975,0.000000,-0.000000,-0.000000,1.000000);
			f(7,6,5,0.630347,0.344095,0.332922,0.343182,0.333975,0.000000,0.000000,-0.000000,1.000000);
			f(0,1,2,0.298548,0.384469,0.001123,0.385382,0.000000,0.019321,0.000000,0.000000,-1.000000);
			f(0,2,3,0.298548,0.384469,0.000000,0.019321,0.297425,0.018408,0.000000,-0.000000,-1.000000);

			this.x = 0.000000;
			this.y = 0.000000;
			this.z = 0.000000;

			this.rotationX = 0.000000;
			this.rotationY = 0.000000;
			this.rotationZ = 0.000000;

			this.scaleX = 1.000000;
			this.scaleY = 1.000000;
			this.scaleZ = 1.000000;

			this.geometry.ready = true;
		}
		public function v(x:Number, y:Number, z:Number):void {
			ve.push(new Vertex3D(x, y, z));
		}

		public function f(vertexIndex1:Number, vertexIndex2:Number, vertexIndex3:Number, uv00:Number, uv01:Number, uv10:Number, uv11:Number, uv20:Number, uv21:Number, normalx:Number, normaly:Number, normalz:Number):void {
			var face : Triangle3D = new Triangle3D(this, [ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3]], null, [ new NumberUV(uv00, uv01), new NumberUV(uv10, uv11), new NumberUV(uv20, uv21) ] );
			face.faceNormal = new Number3D(normalx,normaly,normalz);
			fa.push(face);
		}

		public function f2(vertexIndex1:Number, vertexIndex2:Number, vertexIndex3:Number):void {
			var face:Triangle3D = new Triangle3D(this, [ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3]], null, []);
			fa.push(face);
		}

	}
}